﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using BingVis.GoogleTransit;
using System.Windows.Media;

namespace BingVis.WPFClient
{
    class StopNameToColorConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var stopName = value as string;
            stopName = StopNameLookup.GetStopName(stopName);

            var colors = StopColorLookup.GetStopColors(stopName);

            if (colors.Count < 1)
                return new SolidColorBrush(Colors.White);

            var col = (Color)ColorConverter.ConvertFromString(colors[0]);

            return new SolidColorBrush(col);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
